package com.wjk.kylin.modules.system.position.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.wjk.kylin.core.common.entity.BaseEntity;
import com.wjk.kylin.core.common.valid.insert;
import com.wjk.kylin.core.common.valid.update;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * <p>
 * 岗位表
 * </p>
 *
 * @author wangjkui
 * @since 2020-06-01
 */
@Data
@ToString
@TableName("sys_position")
public class Position extends BaseEntity<Position> {

    /**
     * 岗位名称
     */
    @NotBlank(message = "岗位名称不能为空",groups = {insert.class})
    @Size(min = 0, max = 50, message = "岗位名称长度不能超过50个字符",groups = {insert.class, update.class})
    @TableField("name")
    private String name;

    /**
     * 岗位编码
     */
    @NotBlank(message = "岗位编码不能为空",groups = {insert.class, update.class})
    @Size(min = 0, max = 64, message = "岗位编码长度不能超过64个字符",groups = {insert.class, update.class})
    @TableField("code")
    private String code;

    /**
     * 顺序
     */
    @TableField("sort")
    private Integer sort;

    /**
     * 状态（0正常 1停用）
     */
    @TableField("status")
    @Pattern(regexp="^[0-1]",message = "状态只能为0或1",groups = {insert.class, update.class})
    private String status;

}
